import Money from "../db/entity/Money";
import {Router} from 'express';
import {Op} from 'sequelize';

let router = Router();
router.get('/', day);

async function day(req, res) {

    let rep = await Money.findAll({

        where: {
            [Op.and]: [
                {
                    dateNum: {[Op.gte]: parseInt(req.query.start)}
                },
                {
                    dateNum: {
                        [Op.lte]:
                            parseInt(req.query.end)
                    }
                }


            ]
        }
    });
    res.send(JSON.stringify(rep));
}

module.exports = router;
